package com.njtoyo.taxi.admin.mapper.master.mapper;

import cn.hutool.core.date.DateTime;
import com.baomidou.dynamic.datasource.annotation.DS;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.njtoyo.taxi.admin.library.Const;
import com.njtoyo.taxi.admin.mapper.master.entity.DriverWithdraw;
import com.njtoyo.taxi.admin.rest.export.driver.DriverWithdrawListData;
import com.njtoyo.taxi.admin.rest.presenter.business.driver_withdraw.DriverWithdrawListPresenter;
import com.njtoyo.taxi.admin.rest.wrapper.business.driver_withdraw.IndexWrapper;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;
import org.springframework.stereotype.Repository;

import java.math.BigDecimal;
import java.util.List;

/**
 * <p>
 * Mapper 接口
 * </p>
 *
 * @author Dell
 * @since 2021-11-01
 */
@Repository
@DS(Const.PRIMARY_DS)
public interface DriverWithdrawMapper extends BaseMapper<DriverWithdraw> {
    BigDecimal computeDriverBalance(Long driverId);

    BigDecimal selectDoneAmount(Long driverId);

    BigDecimal selectWaitAmount(Long driverId);

    BigDecimal selectDriverFundsOut(@Param("startTime") DateTime startTime, @Param("endTime") DateTime endTime);

    Page<DriverWithdrawListPresenter> getPage(IndexWrapper wrapper);

    List<DriverWithdrawListData> getExportList(IndexWrapper wrapper);

    BigDecimal waitWithdraw();
}
